home *** CD-ROM | disk | FTP | other *** search
- uncrunch proc
- ;
- ;Parameters Required:
- ; DS:SI Crunched image source pointer.
- ; ES:DI Display address pointer.
- ; CX Length of crunched image source data.
- ;
- PUSH SI ;Save registers.
- PUSH DI
- PUSH AX
- PUSH BX
- PUSH CX
- PUSH DX
- JCXZ Done
-
- MOV DX,DI ;Save X coordinate for later.
- XOR AX,AX ;Set Current attributes.
- CLD
-
- LOOPA: LODSB ;Get next character.
- CMP AL,32 ;If a control character, jump.
- JC ForeGround
- STOSW ;Save letter on screen.
- Next: LOOP LOOPA
- JMP Short Done
-
- ForeGround:
- CMP AL,16 ;If less than 16, then change the
- JNC BackGround ;foreground color. Otherwise jump.
- AND AH,0F0H ;Strip off old foreground.
- OR AH,AL
- JMP Next
-
- BackGround:
- CMP AL,24 ;If less than 24, then change the
- JZ NextLine ;background color. If exactly 24,
- JNC FlashBitToggle ;then jump down to next line.
- SUB AL,16 ;Otherwise jump to multiple output
- ADD AL,AL ;routines.
- ADD AL,AL
- ADD AL,AL
- ADD AL,AL
- AND AH,8FH ;Strip off old background.
- OR AH,AL
- JMP Next
-
- NextLine:
- ADD DX,160 ;If equal to 24,
- MOV DI,DX ;then jump down to
- JMP Next ;the next line.
-
- FlashBitToggle:
- CMP AL,27 ;Does user want to toggle the blink
- JC MultiOutput ;attribute?
- JNZ Next
- XOR AH,128 ;Done.
- JMP Next
-
- MultiOutput:
- CMP AL,25 ;Set Z flag if multi-space output.
- MOV BX,CX ;Save main counter.
- LODSB ;Get count of number of times
- MOV CL,AL ;to display character.
- MOV AL,32
- JZ StartOutput ;Jump here if displaying spaces.
- LODSB ;Otherwise get character to use.
- DEC BX ;Adjust main counter.
-
- StartOutput:
- XOR CH,CH
- INC CX
- REP STOSW
- MOV CX,BX
- DEC CX ;Adjust main counter.
- LOOPNZ LOOPA ;Loop if anything else to do...
-
- Done: POP DX ;Restore registers.
- POP CX
- POP BX
- POP AX
- POP DI
- POP SI
- RET
-
- ENDP